﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using System.Data.OleDb;

public partial class Reg : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Form["Submit"] != null)
        {
            OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("App_Data/MainDB.mdb") + ";Persist Security Info=True");
            OleDbCommand mycomm = new OleDbCommand("INSERT INTO [Users] (UserName,PWD,Name,Gender,Email,QQ,Blog,Occupation,Birthday,Location,Sign) VALUES ('" + Request.Form["UserName"] + "', '" + Request.Form["PWD"] + "', '" + Request.Form["Name"] + "', " + ((Request.Form["Gender"] == "true") ? "TRUE" : "FALSE") + ", '" + Request.Form["Email"] + "', '" + Request.Form["QQ"] + "', '" + Request.Form["Blog"] + "', '" + Request.Form["Occupation"] + "', #" + Request.Form["Birthday"] + "#, '" + Request.Form["Location"] + "', '" + Request.Form["Sign"] + "')", conn);
            conn.Open();
            mycomm.ExecuteNonQuery();
            conn.Close();
            Response.Write("注册成功！请返回主页。");
            Response.End();
        }
    }
}
